package secondDay;

public class twoSum {

    public static void main(String[] args) {
        int[] a = {1,2,4,6,10};
        System.out.println(twoSum(a, 8));
    }
    public static int[] twoSum(int[] numbers, int target) {
        int[] ans = {0, numbers.length - 1};
        while (numbers[ans[0]] + numbers[ans[1]] != target){
            if (numbers[ans[0]] + numbers[ans[1]] < target){
                ans[0]++;
            }else {
                ans[1]--;
            }
        }
        return ans;
    }
}
